home *** CD-ROM | disk | FTP | other *** search
- /* Allocating often used (and comparatively hard to */
- /* calculate) values in static variables */
-
- class threed {
-
- static float sines[] = new float[360];
- static float cosines[] = new float[360];
-
- static {
- double gd;
- for (int g=0;g<360;++g) {
- gd = (double)g * 0.01745;
- sines[g] = (float)Math.sin(gd);
- cosines[g] = (float)Math.cos(gd);
- }
- }
- }
-
- class threedtest {
-
- public static void main (String arg[]) {
-
- // threed t = new threed();
-
- System.out.println(threed.cosines[0]);
- // System.out.println(t.cosines[0]);
- }
- }
-